﻿Imports Microsoft.VisualBasic
Public Class data_analyzer

    Dim rnd As New Random
    Dim is_analyzing As Boolean = False

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Label1.Text = get_data_string(2) & Label1.Text & vbCrLf
        Label2.Text = get_data_string(1) & Label2.Text & vbCrLf
    End Sub

    Private Function get_data_string(ByVal len As Integer) As String

        If Not is_analyzing Then Return vbCrLf

        Dim bar As Byte()
        ReDim bar(len)
        rnd.NextBytes(bar)

        Dim foo As String = ""

        For Each b As Byte In bar
            foo += Conversion.Hex(b) & " "
        Next

        Return foo

    End Function

    Sub start_analyzing()
        Label3.Text = ""
        Label3.Visible = False
        is_analyzing = True
        Application.DoEvents()
        Timer1.Start()
    End Sub

    Sub stop_analyzing()
        is_analyzing = False
    End Sub

    Sub set_info_text(ByVal text As String)
        Label3.Visible = True
        Label3.Text = text
    End Sub

    Sub set_shot(ByVal index As Integer)
        Select Case index
            Case 1
                Me.BackgroundImage = My.Resources.shot1
            Case 2
                Me.BackgroundImage = My.Resources.shot2
            Case 3
                Me.BackgroundImage = My.Resources.shot3
            Case 4
                Me.BackgroundImage = My.Resources.shot4
        End Select
    End Sub

End Class